home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / doom / quake.zip / HIPGRAPL.ZIP / PLAYER.QC < prev    next >
Text File  |  1997-04-09  |  25KB  |  820 lines

  1.  
  2. void() bubble_bob;
  3.  
  4. // Grapple:  some decs for my new functions
  5. void() W_FireChain;
  6. void() player_chain4;
  7.  
  8. /*
  9. ==============================================================================
  10.  
  11. PLAYER
  12.  
  13. ==============================================================================
  14. */
  15.  
  16. $cd id1/models/player_4
  17. $origin 0 -6 24
  18. $base base
  19. $skin skin
  20.  
  21. //
  22. // running
  23. //
  24. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  25.  
  26. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  27.  
  28. //
  29. // standing
  30. //
  31. $frame stand1 stand2 stand3 stand4 stand5
  32.  
  33. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  34. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  35.  
  36.  
  37. //
  38. // pain
  39. //
  40. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  41.  
  42. $frame pain1 pain2 pain3 pain4 pain5 pain6
  43.  
  44.  
  45. //
  46. // death
  47. //
  48.  
  49. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  50. $frame axdeth7 axdeth8 axdeth9
  51.  
  52. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  53. $frame deatha9 deatha10 deatha11
  54.  
  55. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  56. $frame deathb9
  57.  
  58. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  59. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  60.  
  61. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  62. $frame deathd8 deathd9
  63.  
  64. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  65. $frame deathe8 deathe9
  66.  
  67. //
  68. // attacks
  69. //
  70. $frame nailatt1 nailatt2
  71.  
  72. $frame light1 light2
  73.  
  74. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  75.  
  76. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  77.  
  78. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  79.  
  80. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  81.  
  82. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  83.  
  84. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  85.  
  86.  
  87. /*
  88. ==============================================================================
  89. PLAYER
  90. ==============================================================================
  91. */
  92.  
  93. void() player_run;
  94.  
  95. void()    player_stand1 =[    $axstnd1,    player_stand1    ]
  96. {
  97.     self.weaponframe=0;
  98.     if (self.velocity_x || self.velocity_y)
  99.     {
  100.         self.walkframe=0;
  101.         player_run();
  102.         return;
  103.     }
  104.  
  105. // Grapple:  If it's a morningstar, have the player tote the axe.
  106.  
  107.         if (self.weapon == IT_AXE || self.weapon == IT_MORNINGSTAR)
  108.     {
  109.         if (self.walkframe >= 12)
  110.             self.walkframe = 0;
  111.         self.frame = $axstnd1 + self.walkframe;
  112.     }
  113.    else if (self.weapon == IT_MJOLNIR)
  114.     {
  115.         if (self.walkframe >= 12)
  116.             self.walkframe = 0;
  117.       self.frame = 6 + self.walkframe;
  118.     }
  119.    else
  120.     {
  121.         if (self.walkframe >= 5)
  122.             self.walkframe = 0;
  123.         self.frame = $stand1 + self.walkframe;
  124.     }
  125.     self.walkframe = self.walkframe + 1;
  126. };
  127.  
  128. void()   player_run =[  $rockrun1,  player_run  ]
  129. {
  130.     self.weaponframe=0;
  131.     if (!self.velocity_x && !self.velocity_y)
  132.     {
  133.         self.walkframe=0;
  134.         player_stand1();
  135.         return;
  136.     }
  137.  
  138. // Grapple:  Here, too.
  139.  
  140.     if (self.weapon == IT_AXE || self.weapon == IT_MORNINGSTAR)
  141.     {
  142.         if (self.walkframe == 6)
  143.             self.walkframe = 0;
  144.         self.frame = $axrun1 + self.walkframe;
  145.     }
  146.    else if (self.weapon == IT_MJOLNIR)
  147.     {
  148.       if (self.walkframe == 6)
  149.             self.walkframe = 0;
  150.       self.frame = self.walkframe;
  151.     }
  152.    else
  153.     {
  154.         if (self.walkframe == 6)
  155.             self.walkframe = 0;
  156.         self.frame = self.frame + self.walkframe;
  157.     }
  158.    if (footsteps == 1)
  159.       {
  160.       self.spawnsilent = self.spawnsilent + vlen(self.origin - self.old_velocity);
  161.       self.old_velocity = self.origin;
  162.       if (self.flags & FL_ONGROUND)
  163.          {
  164.          if (self.spawnsilent > 95)
  165.             {
  166.             local float r;
  167.             if (self.spawnsilent > 190)
  168.                self.spawnsilent = 0;
  169.             else
  170.                {
  171.                self.spawnsilent = 0.5*(self.spawnsilent - 95);
  172.                }
  173.             r = random();
  174.             if (r < 0.14)
  175.                sound (self, CHAN_VOICE, "misc/foot1.wav", 0.5, ATTN_NORM);
  176.             else if (r < 0.29)
  177.                sound (self, CHAN_VOICE, "misc/foot2.wav", 0.5, ATTN_NORM);
  178.             else if (r < 0.43)
  179.                sound (self, CHAN_VOICE, "misc/foot3.wav", 0.5, ATTN_NORM);
  180.             else if (r < 0.58)
  181.                sound (self, CHAN_VOICE, "misc/foot4.wav", 0.5, ATTN_NORM);
  182.             else if (r < 0.72)
  183.                sound (self, CHAN_VOICE, "misc/foot5.wav", 0.5, ATTN_NORM);
  184.             else if (r < 0.86)
  185.                sound (self, CHAN_VOICE, "misc/foot6.wav", 0.5, ATTN_NORM);
  186.             else
  187.                sound (self, CHAN_VOICE, "misc/foot7.wav", 0.5, ATTN_NORM);
  188.             }
  189.          }
  190.       }
  191.    self.walkframe = self.walkframe + 1;
  192. };
  193.  
  194.  
  195. void()    player_shot1 =    [$shotatt1, player_shot2    ] {self.weaponframe=1;
  196. self.effects = self.effects | EF_MUZZLEFLASH;};
  197. void()    player_shot2 =    [$shotatt2, player_shot3    ] {self.weaponframe=2;};
  198. void()    player_shot3 =    [$shotatt3, player_shot4    ] {self.weaponframe=3;};
  199. void()    player_shot4 =    [$shotatt4, player_shot5    ] {self.weaponframe=4;};
  200. void()    player_shot5 =    [$shotatt5, player_shot6    ] {self.weaponframe=5;};
  201. void()    player_shot6 =    [$shotatt6, player_run    ] {self.weaponframe=6;};
  202.  
  203. void()    player_axe1 =    [$axatt1, player_axe2    ] {self.weaponframe=1;};
  204. void()    player_axe2 =    [$axatt2, player_axe3    ] {self.weaponframe=2;};
  205. void()    player_axe3 =    [$axatt3, player_axe4    ] {self.weaponframe=3;W_FireAxe();};
  206. void()    player_axe4 =    [$axatt4, player_run    ] {self.weaponframe=4;};
  207.  
  208. void()    player_axeb1 =    [$axattb1, player_axeb2    ] {self.weaponframe=5;};
  209. void()    player_axeb2 =    [$axattb2, player_axeb3    ] {self.weaponframe=6;};
  210. void()    player_axeb3 =    [$axattb3, player_axeb4    ] {self.weaponframe=7;W_FireAxe();};
  211. void()    player_axeb4 =    [$axattb4, player_run    ] {self.weaponframe=8;};
  212.  
  213. void()    player_axec1 =    [$axattc1, player_axec2    ] {self.weaponframe=1;};
  214. void()    player_axec2 =    [$axattc2, player_axec3    ] {self.weaponframe=2;};
  215. void()    player_axec3 =    [$axattc3, player_axec4    ] {self.weaponframe=3;W_FireAxe();};
  216. void()    player_axec4 =    [$axattc4, player_run    ] {self.weaponframe=4;};
  217.  
  218. void()    player_axed1 =    [$axattd1, player_axed2    ] {self.weaponframe=5;};
  219. void()    player_axed2 =    [$axattd2, player_axed3    ] {self.weaponframe=6;};
  220. void()    player_axed3 =    [$axattd3, player_axed4    ] {self.weaponframe=7;W_FireAxe();};
  221. void()    player_axed4 =    [$axattd4, player_run    ] {self.weaponframe=8;};
  222.  
  223. // Grapple:  Here's the grapple frames!
  224. void()  player_chain1=  [$axattd1, player_chain2 ] {self.weaponframe=2;};
  225. void()  player_chain2=  [$axattd2, player_chain3 ] {self.weaponframe=3;W_FireChain();};
  226.  
  227. void()  player_chain3=  [$axattd3, player_chain3 ]
  228. {
  229.         self.weaponframe=4;
  230.         if (!self.hook_out)
  231.         {
  232.                 player_chain4();
  233.                 return;
  234.         }
  235. };
  236. void()  player_chain4=  [$axattd4, player_run    ] {self.weaponframe=5;};
  237.  
  238.  
  239. //============================================================================
  240.  
  241. //============================================================================
  242.  
  243. void() player_nail1   =[$nailatt1, player_nail2  ]
  244. {
  245.     self.effects = self.effects | EF_MUZZLEFLASH;
  246.  
  247.     if (!self.button0)
  248.         {player_run ();return;}
  249.     self.weaponframe = self.weaponframe + 1;
  250.     if (self.weaponframe == 9)
  251.         self.weaponframe = 1;
  252.     SuperDamageSound();
  253.     W_FireSpikes (4);
  254.     self.attack_finished = time + 0.2;
  255. };
  256. void() player_nail2   =[$nailatt2, player_nail1  ]
  257. {
  258.     self.effects = self.effects | EF_MUZZLEFLASH;
  259.  
  260.     if (!self.button0)
  261.         {player_run ();return;}
  262.     self.weaponframe = self.weaponframe + 1;
  263.     if (self.weaponframe == 9)
  264.         self.weaponframe = 1;
  265.     SuperDamageSound();
  266.     W_FireSpikes (-4);
  267.     self.attack_finished = time + 0.2;
  268. };
  269.  
  270. //============================================================================
  271.  
  272. void() player_light1   =[$light1, player_light2  ]
  273. {
  274.     self.effects = self.effects | EF_MUZZLEFLASH;
  275.  
  276.     if (!self.button0)
  277.         {player_run ();return;}
  278.     self.weaponframe = self.weaponframe + 1;
  279.     if (self.weaponframe == 5)
  280.         self.weaponframe = 1;
  281.     SuperDamageSound();
  282.     W_FireLightning();
  283.     self.attack_finished = time + 0.2;
  284. };
  285. void() player_light2   =[$light2, player_light1  ]
  286. {
  287.     self.effects = self.effects | EF_MUZZLEFLASH;
  288.  
  289.     if (!self.button0)
  290.         {player_run ();return;}
  291.     self.weaponframe = self.weaponframe + 1;
  292.     if (self.weaponframe == 5)
  293.         self.weaponframe = 1;
  294.     SuperDamageSound();
  295.     W_FireLightning();
  296.     self.attack_finished = time + 0.2;
  297. };
  298.  
  299. //MED 10/18/96 added HIPWEAPONS
  300. //============================================================================
  301.  
  302. void()   player_hammer1 =  [32, player_hammer2   ] {self.weaponframe=1;};
  303. void()   player_hammer2 =  [33, player_hammer3   ] {self.weaponframe=2;};
  304. void()   player_hammer3 =  [34, player_hammer4   ] {self.weaponframe=3;};
  305. void()   player_hammer4 =  [35, player_hammer5   ] {self.weaponframe=4;HIP_FireMjolnir();};
  306. void()   player_hammer5 =  [36, player_hammer6   ] {self.weaponframe=4;};
  307. void()   player_hammer6 =  [37, player_run ] {self.weaponframe=4;};
  308.  
  309. void()   player_mjolnir1 =  [38, player_mjolnir2   ] {self.weaponframe=1;};
  310. void()   player_mjolnir2 =  [39, player_mjolnir3   ] {self.weaponframe=2;};
  311. void()   player_mjolnir3 =  [40, player_mjolnir4   ] {self.weaponframe=3;};
  312. void()   player_mjolnir4 =  [41, player_mjolnir5   ] {self.weaponframe=4;HIP_FireMjolnir();};
  313. void()   player_mjolnir5 =  [42, player_mjolnir6   ] {self.weaponframe=4;};
  314. void()   player_mjolnir6 =  [43, player_run ] {self.weaponframe=4;};
  315.  
  316. //============================================================================
  317.  
  318. //MED 10/18/96 added HIPSWEAPONS
  319. //void() player_laser1   =[$nailatt1, player_laser2  ] {self.attack_finished = time + 0.1;self.weaponframe=1;self.nextthink = time + 0.09;HIP_FireLaser(0);};
  320. //void() player_laser2   =[$nailatt2, player_laser4  ] {self.attack_finished = time + 0.1;self.weaponframe=2;self.nextthink = time + 0.09;};
  321. //void() player_laser3   =[$nailatt1, player_laser4  ] {self.attack_finished = time + 0.1;self.weaponframe=3;self.nextthink = time + 0.09;};
  322. //void() player_laser4   =[$nailatt2, player_laser5  ] {self.attack_finished = time + 0.1;self.weaponframe=4;self.nextthink = time + 0.09;HIP_FireLaser(1);};
  323. //void() player_laser5   =[$nailatt1, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=5;self.nextthink = time + 0.09;};
  324. //void() player_laser6   =[$nailatt2, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=6;self.nextthink = time + 0.09;};
  325. void() player_laser1   =[$nailatt1, player_laser3  ] {self.attack_finished = time + 0.1;self.weaponframe=1;self.nextthink = time + 0.1;HIP_FireLaser(0);};
  326. void() player_laser2   =[$nailatt2, player_laser3  ] {self.attack_finished = time + 0.1;self.weaponframe=2;self.nextthink = time + 0.1;};
  327. void() player_laser3   =[$nailatt2, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=4;self.nextthink = time + 0.1;HIP_FireLaser(1);};
  328. void() player_laser4   =[$nailatt1, player_laser1  ] {self.attack_finished = time + 0.1;self.weaponframe=5;self.nextthink = time + 0.1;};
  329. //============================================================================
  330.  
  331.  
  332. void() player_rocket1   =[$rockatt1, player_rocket2  ] {self.weaponframe=1;
  333. self.effects = self.effects | EF_MUZZLEFLASH;};
  334. void() player_rocket2   =[$rockatt2, player_rocket3  ] {self.weaponframe=2;};
  335. void() player_rocket3   =[$rockatt3, player_rocket4  ] {self.weaponframe=3;};
  336. void() player_rocket4   =[$rockatt4, player_rocket5  ] {self.weaponframe=4;};
  337. void() player_rocket5   =[$rockatt5, player_rocket6  ] {self.weaponframe=5;};
  338. void() player_rocket6   =[$rockatt6, player_run  ] {self.weaponframe=6;};
  339. void(float num_bubbles) DeathBubbles;
  340.  
  341. void() PainSound =
  342. {
  343. local float        rs;
  344.  
  345.     if (self.health < 0)
  346.         return;
  347.  
  348.     if (damage_attacker.classname == "teledeath")
  349.     {
  350.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  351.         return;
  352.     }
  353.  
  354. // water pain sounds
  355.     if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
  356.     {
  357.         DeathBubbles(1);
  358.         if (random() > 0.5)
  359.             sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
  360.         else
  361.             sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
  362.         return;
  363.     }
  364.  
  365. // slime pain sounds
  366.     if (self.watertype == CONTENT_SLIME)
  367.     {
  368. // FIX ME    put in some steam here
  369.         if (random() > 0.5)
  370.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  371.         else
  372.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  373.         return;
  374.     }
  375.  
  376.     if (self.watertype == CONTENT_LAVA)
  377.     {
  378.         if (random() > 0.5)
  379.             sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  380.         else
  381.             sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  382.         return;
  383.     }
  384.  
  385.     if (self.pain_finished > time)
  386.     {
  387.         self.axhitme = 0;
  388.         return;
  389.     }
  390.     self.pain_finished = time + 0.5;
  391.  
  392. // don't make multiple pain sounds right after each other
  393.  
  394. // ax pain sound
  395.     if (self.axhitme == 1)
  396.     {
  397.         self.axhitme = 0;
  398.         sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
  399.         return;
  400.     }
  401.  
  402.  
  403.     rs = rint((random() * 5) + 1);
  404.  
  405.     self.noise = "";
  406.     if (rs == 1)
  407.         self.noise = "player/pain1.wav";
  408.     else if (rs == 2)
  409.         self.noise = "player/pain2.wav";
  410.     else if (rs == 3)
  411.         self.noise = "player/pain3.wav";
  412.     else if (rs == 4)
  413.         self.noise = "player/pain4.wav";
  414.     else if (rs == 5)
  415.         self.noise = "player/pain5.wav";
  416.     else
  417.         self.noise = "player/pain6.wav";
  418.  
  419.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  420.     return;
  421. };
  422.  
  423. void()    player_pain1 =    [    $pain1,    player_pain2    ] {PainSound();self.weaponframe=0;};
  424. void()    player_pain2 =    [    $pain2,    player_pain3    ] {};
  425. void()    player_pain3 =    [    $pain3,    player_pain4    ] {};
  426. void()    player_pain4 =    [    $pain4,    player_pain5    ] {};
  427. void()    player_pain5 =    [    $pain5,    player_pain6    ] {};
  428. void()    player_pain6 =    [    $pain6,    player_run    ] {};
  429.  
  430. void()    player_axpain1 =    [    $axpain1,    player_axpain2    ] {PainSound();self.weaponframe=0;};
  431. void()    player_axpain2 =    [    $axpain2,    player_axpain3    ] {};
  432. void()    player_axpain3 =    [    $axpain3,    player_axpain4    ] {};
  433. void()    player_axpain4 =    [    $axpain4,    player_axpain5    ] {};
  434. void()    player_axpain5 =    [    $axpain5,    player_axpain6    ] {};
  435. void()    player_axpain6 =    [    $axpain6,    player_run    ] {};
  436.  
  437. void()   player_hampain1 =  [  18,   player_hampain2 ] {PainSound();self.weaponframe=0;};
  438. void()   player_hampain2 =  [  19,   player_hampain3 ] {};
  439. void()   player_hampain3 =  [  20,   player_hampain4 ] {};
  440. void()   player_hampain4 =  [  21,   player_hampain5 ] {};
  441. void()   player_hampain5 =  [  22,   player_hampain6 ] {};
  442. void()   player_hampain6 =  [  23,   player_run  ] {};
  443.  
  444. void() player_pain =
  445. {
  446.     if (self.weaponframe)
  447.         return;
  448.  
  449.     if (self.invisible_finished > time)
  450.         return;        // eyes don't have pain frames
  451.  
  452. // Grapple:  Use axe player frames here, too!
  453.  
  454.    if (self.weapon == IT_AXE || self.weapon == IT_MORNINGSTAR)
  455.         player_axpain1 ();
  456.    else if (self.weapon == IT_MJOLNIR)
  457.       player_hampain1 ();
  458.    else
  459.         player_pain1 ();
  460. };
  461.  
  462. void() player_diea1;
  463. void() player_dieb1;
  464. void() player_diec1;
  465. void() player_died1;
  466. void() player_diee1;
  467. void() player_die_ax1;
  468. void() player_die_ham1;
  469.  
  470. void() DeathBubblesSpawn =
  471. {
  472. local entity    bubble;
  473.     if (self.owner.waterlevel != 3)
  474.         return;
  475.     bubble = spawn();
  476.     setmodel (bubble, "progs/s_bubble.spr");
  477.     setorigin (bubble, self.owner.origin + '0 0 24');
  478.     bubble.movetype = MOVETYPE_NOCLIP;
  479.     bubble.solid = SOLID_NOT;
  480.     bubble.velocity = '0 0 15';
  481.     bubble.nextthink = time + 0.5;
  482.     bubble.think = bubble_bob;
  483.     bubble.classname = "bubble";
  484.     bubble.frame = 0;
  485.     bubble.cnt = 0;
  486.     setsize (bubble, '-8 -8 -8', '8 8 8');
  487.     self.nextthink = time + 0.1;
  488.     self.think = DeathBubblesSpawn;
  489.     self.air_finished = self.air_finished + 1;
  490.     if (self.air_finished >= self.bubble_count)
  491.         remove(self);
  492. };
  493.  
  494. void(float num_bubbles) DeathBubbles =
  495. {
  496. local entity    bubble_spawner;
  497.  
  498.     bubble_spawner = spawn();
  499.     setorigin (bubble_spawner, self.origin);
  500.     bubble_spawner.movetype = MOVETYPE_NONE;
  501.     bubble_spawner.solid = SOLID_NOT;
  502.     bubble_spawner.nextthink = time + 0.1;
  503.     bubble_spawner.think = DeathBubblesSpawn;
  504.     bubble_spawner.air_finished = 0;
  505.     bubble_spawner.owner = self;
  506.     bubble_spawner.bubble_count = num_bubbles;
  507.     return;
  508. };
  509.  
  510.  
  511. void() DeathSound =
  512. {
  513. local float        rs;
  514.  
  515.     // water death sounds
  516.     if (self.waterlevel == 3)
  517.     {
  518.         DeathBubbles(20);
  519.         sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
  520.         return;
  521.     }
  522.  
  523.     rs = rint ((random() * 4) + 1);
  524.     if (rs == 1)
  525.         self.noise = "player/death1.wav";
  526.     if (rs == 2)
  527.         self.noise = "player/death2.wav";
  528.     if (rs == 3)
  529.         self.noise = "player/death3.wav";
  530.     if (rs == 4)
  531.         self.noise = "player/death4.wav";
  532.     if (rs == 5)
  533.         self.noise = "player/death5.wav";
  534.  
  535.     sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
  536.     return;
  537. };
  538.  
  539.  
  540. void() PlayerDead =
  541. {
  542.     self.nextthink = -1;
  543. // allow respawn after a certain time
  544.     self.deadflag = DEAD_DEAD;
  545. };
  546.  
  547. vector(float dm) VelocityForDamage =
  548. {
  549.     local vector v;
  550.  
  551. //MED 01/17/97
  552.    if (vlen(damage_inflictor.velocity)>0)
  553.       {
  554.       v = 0.2 * damage_inflictor.velocity;
  555.       v = v + (25 * normalize(self.origin-damage_inflictor.origin));
  556.       v_z = 100 + 100 * random();
  557.       v_x = v_x + (50 * crandom());
  558.       v_y = v_y + (50 * crandom());
  559.       }
  560.    else
  561.       {
  562.       v_x = 100 * crandom();
  563.       v_y = 100 * crandom();
  564.       v_z = 200 + 100 * random();
  565.       }
  566.    if (dm > -50)
  567.    {
  568. //    dprint ("level 1\n");
  569.       v = v * 0.7;
  570.    }
  571.    else if (dm > -200)
  572.    {
  573. //    dprint ("level 3\n");
  574.       v = v * 2;
  575.    }
  576.    else
  577.       v = v * 10;
  578.    return v;
  579. };
  580.  
  581. void(string gibname, float dm) ThrowGib =
  582. {
  583.     local    entity new;
  584.  
  585.     new = spawn();
  586.     new.origin = self.origin;
  587.     setmodel (new, gibname);
  588.     setsize (new, '0 0 0', '0 0 0');
  589.     new.velocity = VelocityForDamage (dm);
  590.     new.movetype = MOVETYPE_BOUNCE;
  591.     new.solid = SOLID_NOT;
  592.     new.avelocity_x = random()*600;
  593.     new.avelocity_y = random()*600;
  594.     new.avelocity_z = random()*600;
  595.     new.think = SUB_Remove;
  596.     new.ltime = time;
  597.     new.nextthink = time + 10 + random()*10;
  598.     new.frame = 0;
  599.     new.flags = 0;
  600. };
  601.  
  602. //MED
  603. void() HeadThink =
  604.    {
  605.    self.nextthink = -1;
  606.    if (world.worldtype != 2)
  607.       {
  608.       if (random()<0.1)
  609.          sound (self, 6, "misc/flys.wav", 0.7, ATTN_STATIC);
  610.       }
  611.    };
  612.  
  613. void(string gibname, float dm) ThrowHead =
  614. {
  615.     setmodel (self, gibname);
  616.     self.frame = 0;
  617. //   self.nextthink = -1;
  618. //MED
  619.    self.nextthink = time + 1.5;
  620.     self.movetype = MOVETYPE_BOUNCE;
  621.     self.takedamage = DAMAGE_NO;
  622.     self.solid = SOLID_NOT;
  623.     self.view_ofs = '0 0 8';
  624.     setsize (self, '-16 -16 0', '16 16 56');
  625.     self.velocity = VelocityForDamage (dm);
  626.     self.origin_z = self.origin_z - 24;
  627.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  628.     self.avelocity = crandom() * '0 600 0';
  629. //MED
  630.    self.gorging = TRUE;
  631.    self.think = HeadThink;
  632. };
  633.  
  634.  
  635. void() GibPlayer =
  636. {
  637.     ThrowHead ("progs/h_player.mdl", self.health);
  638.     ThrowGib ("progs/gib1.mdl", self.health);
  639.     ThrowGib ("progs/gib2.mdl", self.health);
  640.     ThrowGib ("progs/gib3.mdl", self.health);
  641.  
  642.     self.deadflag = DEAD_DEAD;
  643.  
  644.     if (damage_attacker.classname == "teledeath")
  645.     {
  646.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  647.         return;
  648.     }
  649.  
  650.     if (damage_attacker.classname == "teledeath2")
  651.     {
  652.         sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  653.         return;
  654.     }
  655.  
  656.     if (random() < 0.5)
  657.         sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  658.     else
  659.         sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  660. };
  661.  
  662. void() PlayerDie =
  663. {
  664.     local    float    i;
  665.  
  666.    self.items = self.items - (self.items & IT_INVISIBILITY);
  667.     self.invisible_finished = 0;    // don't die as eyes
  668.     self.invincible_finished = 0;
  669.     self.super_damage_finished = 0;
  670.     self.radsuit_finished = 0;
  671.     //JIM
  672.     self.wetsuit_finished = 0;
  673.    self.modelindex = modelindex_player;   // don't use eyes
  674.    //JIM
  675.    self.empathy_finished = 0;
  676.    self.items2 = self.items2 - (self.items2 & HIP_IT_EMPATHY_SHIELDS);
  677.  
  678.     if (deathmatch || coop)
  679.         DropBackpack();
  680.  
  681.     self.weaponmodel="";
  682.     self.view_ofs = '0 0 -8';
  683.     self.deadflag = DEAD_DYING;
  684.     self.solid = SOLID_NOT;
  685.     self.flags = self.flags - (self.flags & FL_ONGROUND);
  686.     self.movetype = MOVETYPE_TOSS;
  687.     if (self.velocity_z < 10)
  688.         self.velocity_z = self.velocity_z + random()*300;
  689.  
  690.     if (self.health < -40)
  691.     {
  692.         GibPlayer ();
  693.         return;
  694.     }
  695.  
  696.     DeathSound();
  697.  
  698.     self.angles_x = 0;
  699.     self.angles_z = 0;
  700.  
  701. // Grapple:  Wish I had a model of the guy with a grapple, but...
  702.         if (self.weapon == IT_AXE || self.weapon == IT_MORNINGSTAR)
  703.     {
  704.         player_die_ax1 ();
  705.         return;
  706.     }
  707.    //MED 12/04/96
  708.    else if (self.weapon == IT_MJOLNIR)
  709.       {
  710.       self.modelindex = modelindex_hammer; // use hammer model
  711.       player_die_ham1();
  712.       return;
  713.       }
  714.  
  715.     i = cvar("temp1");
  716.     if (!i)
  717.         i = 1 + floor(random()*6);
  718.  
  719.     if (i == 1)
  720.         player_diea1();
  721.     else if (i == 2)
  722.         player_dieb1();
  723.     else if (i == 3)
  724.         player_diec1();
  725.     else if (i == 4)
  726.         player_died1();
  727.     else
  728.         player_diee1();
  729.  
  730. };
  731.  
  732. void() set_suicide_frame =
  733. {    // used by klill command and diconnect command
  734.     if (self.model != "progs/player.mdl")
  735.         return;    // allready gibbed
  736.     self.frame = $deatha11;
  737.     self.solid = SOLID_NOT;
  738.     self.movetype = MOVETYPE_TOSS;
  739.     self.deadflag = DEAD_DEAD;
  740.     self.nextthink = -1;
  741. };
  742.  
  743.  
  744. void()    player_diea1    =    [    $deatha1,    player_diea2    ] {};
  745. void()    player_diea2    =    [    $deatha2,    player_diea3    ] {};
  746. void()    player_diea3    =    [    $deatha3,    player_diea4    ] {};
  747. void()    player_diea4    =    [    $deatha4,    player_diea5    ] {};
  748. void()    player_diea5    =    [    $deatha5,    player_diea6    ] {};
  749. void()    player_diea6    =    [    $deatha6,    player_diea7    ] {};
  750. void()    player_diea7    =    [    $deatha7,    player_diea8    ] {};
  751. void()    player_diea8    =    [    $deatha8,    player_diea9    ] {};
  752. void()    player_diea9    =    [    $deatha9,    player_diea10    ] {};
  753. void()    player_diea10    =    [    $deatha10,    player_diea11    ] {};
  754. void()    player_diea11    =    [    $deatha11,    player_diea11 ] {PlayerDead();};
  755.  
  756. void()    player_dieb1    =    [    $deathb1,    player_dieb2    ] {};
  757. void()    player_dieb2    =    [    $deathb2,    player_dieb3    ] {};
  758. void()    player_dieb3    =    [    $deathb3,    player_dieb4    ] {};
  759. void()    player_dieb4    =    [    $deathb4,    player_dieb5    ] {};
  760. void()    player_dieb5    =    [    $deathb5,    player_dieb6    ] {};
  761. void()    player_dieb6    =    [    $deathb6,    player_dieb7    ] {};
  762. void()    player_dieb7    =    [    $deathb7,    player_dieb8    ] {};
  763. void()    player_dieb8    =    [    $deathb8,    player_dieb9    ] {};
  764. void()    player_dieb9    =    [    $deathb9,    player_dieb9    ] {PlayerDead();};
  765.  
  766. void()    player_diec1    =    [    $deathc1,    player_diec2    ] {};
  767. void()    player_diec2    =    [    $deathc2,    player_diec3    ] {};
  768. void()    player_diec3    =    [    $deathc3,    player_diec4    ] {};
  769. void()    player_diec4    =    [    $deathc4,    player_diec5    ] {};
  770. void()    player_diec5    =    [    $deathc5,    player_diec6    ] {};
  771. void()    player_diec6    =    [    $deathc6,    player_diec7    ] {};
  772. void()    player_diec7    =    [    $deathc7,    player_diec8    ] {};
  773. void()    player_diec8    =    [    $deathc8,    player_diec9    ] {};
  774. void()    player_diec9    =    [    $deathc9,    player_diec10    ] {};
  775. void()    player_diec10    =    [    $deathc10,    player_diec11    ] {};
  776. void()    player_diec11    =    [    $deathc11,    player_diec12    ] {};
  777. void()    player_diec12    =    [    $deathc12,    player_diec13    ] {};
  778. void()    player_diec13    =    [    $deathc13,    player_diec14    ] {};
  779. void()    player_diec14    =    [    $deathc14,    player_diec15    ] {};
  780. void()    player_diec15    =    [    $deathc15,    player_diec15 ] {PlayerDead();};
  781.  
  782. void()    player_died1    =    [    $deathd1,    player_died2    ] {};
  783. void()    player_died2    =    [    $deathd2,    player_died3    ] {};
  784. void()    player_died3    =    [    $deathd3,    player_died4    ] {};
  785. void()    player_died4    =    [    $deathd4,    player_died5    ] {};
  786. void()    player_died5    =    [    $deathd5,    player_died6    ] {};
  787. void()    player_died6    =    [    $deathd6,    player_died7    ] {};
  788. void()    player_died7    =    [    $deathd7,    player_died8    ] {};
  789. void()    player_died8    =    [    $deathd8,    player_died9    ] {};
  790. void()    player_died9    =    [    $deathd9,    player_died9    ] {PlayerDead();};
  791.  
  792. void()    player_diee1    =    [    $deathe1,    player_diee2    ] {};
  793. void()    player_diee2    =    [    $deathe2,    player_diee3    ] {};
  794. void()    player_diee3    =    [    $deathe3,    player_diee4    ] {};
  795. void()    player_diee4    =    [    $deathe4,    player_diee5    ] {};
  796. void()    player_diee5    =    [    $deathe5,    player_diee6    ] {};
  797. void()    player_diee6    =    [    $deathe6,    player_diee7    ] {};
  798. void()    player_diee7    =    [    $deathe7,    player_diee8    ] {};
  799. void()    player_diee8    =    [    $deathe8,    player_diee9    ] {};
  800. void()    player_diee9    =    [    $deathe9,    player_diee9    ] {PlayerDead();};
  801.  
  802. void()    player_die_ax1    =    [    $axdeth1,    player_die_ax2    ] {};
  803. void()    player_die_ax2    =    [    $axdeth2,    player_die_ax3    ] {};
  804. void()    player_die_ax3    =    [    $axdeth3,    player_die_ax4    ] {};
  805. void()    player_die_ax4    =    [    $axdeth4,    player_die_ax5    ] {};
  806. void()    player_die_ax5    =    [    $axdeth5,    player_die_ax6    ] {};
  807. void()    player_die_ax6    =    [    $axdeth6,    player_die_ax7    ] {};
  808. void()    player_die_ax7    =    [    $axdeth7,    player_die_ax8    ] {};
  809. void()    player_die_ax8    =    [    $axdeth8,    player_die_ax9    ] {};
  810. void()    player_die_ax9    =    [    $axdeth9,    player_die_ax9    ] {PlayerDead();};
  811.  
  812. void()   player_die_ham1 =  [ 24 ,   player_die_ham2 ] {};
  813. void()   player_die_ham2 =  [ 25 ,   player_die_ham3 ] {};
  814. void()   player_die_ham3 =  [ 26 ,   player_die_ham4 ] {};
  815. void()   player_die_ham4 =  [ 27 ,   player_die_ham5 ] {};
  816. void()   player_die_ham5 =  [ 28 ,   player_die_ham6 ] {};
  817. void()   player_die_ham6 =  [ 29 ,   player_die_ham7 ] {};
  818. void()   player_die_ham7 =  [ 30 ,   player_die_ham8 ] {};
  819. void()   player_die_ham8 =  [ 31 ,   player_die_ham8 ] {PlayerDead();};
  820.